Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support exotic sighashes #623

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Support exotic sighashes #623

wants to merge 1 commit into from

Conversation

1ma
Copy link
Contributor

@1ma 1ma commented Nov 6, 2024

Description

Solves issue #545

Before this change, attempting to sign a psbt specifying any sighash other than SIGHASH_ALL would show an error on the Seedsigner.

The gist of the issue is that if the sighash argument of psbt.sign_with() is not explitictly set to None, embit doesn't take the sighash in the psbt into account. With sighash=None, embit signs each input in the manner that the psbt data specifies.

This has been tested in native segwit and taproot. However, taproot transactions with an exotic sighash are not signed correctly. I suspect this could be an issue with embit, not seedsigner.

I'm not sure how to write a test for this change, feedback appreciated.

Testing approach

  1. Set up the Seedsigner emulator and configured it in testnet mode.
  2. Loaded a dummy seed into the seedsigner (e.g. aim 12 times).
  3. Created a cold wallet in Sparrow by exporting the xpub of that seed.
  4. Sent some testnet sats to this new wallet.
  5. Created a transaction from Sparrow. In the next menu, a non-standard sighash such as SINGLE|ACP was chosen.
  6. Scanned the unsigned transaction QR with seedsigner and signed it.
  7. Scanned the signed transaction QR from Sparrow and broadcasted it.

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Documentation
  • Other

Checklist

  • I’ve run pytest and made sure all unit tests pass before sumbitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms/os:

Note: Keep your changes limited in scope; if you uncover other issues or improvements along the way, ideally submit those as a separate PR. The more complicated the PR the harder to review, test, and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant